using Microsoft.AspNetCore.Mvc.Filters;

namespace Geekeradmin.Filters
{
    /// <summary>
    /// Action方法过滤器(适合做日志)
    /// 执行步骤：构造函数》OnActionExecuting》Action方法》OnActionExecuted
    /// </summary>
    public class CustomAction : Attribute, IActionFilter
    {
        /// <summary>
        /// 方法执行前
        /// </summary>
        /// <param name="context"></param>
        /// <exception cref="NotImplementedException"></exception>
        public void OnActionExecuting(ActionExecutingContext context)
        {
            Console.WriteLine("OnActionExecuting.....");
        }

        /// <summary>
        /// 方法执行后
        /// </summary>
        /// <param name="context"></param>
        /// <exception cref="NotImplementedException"></exception>
        public void OnActionExecuted(ActionExecutedContext context)
        {
            Console.WriteLine("OnActionExecuted.....");
        }
    }
}
